package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;

public class OSWDemo {//例子做了解,非常用用法
    public static void main(String[] args) throws IOException {
        FileOutputStream fos =new FileOutputStream("osw.txt");
        OutputStreamWriter osw =new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        osw.write("天不生夫子");
        osw.write("万古长如夜");
        System.out.println("写出完毕");
        osw.close();//关闭高级流会自动关闭低级流
    }
}
